<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('详情')"/>
  <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-${tableName}-view" th:object="${r'${viewObject}'}">
    <input name="${keyName!}" th:field="*{${keyName!}}" type="hidden">

      <#list  columns as field>
      <#if field_index %2==0>
    <div class="row form-group">
        </#if>

      <label class="col-sm-2 control-label">${field.columnComment!}：</label>
      <div class="col-sm-4">
          <#if field.javaType=="Date">
            <div id="${field.columnName!}" name="${field.columnName!}"
                 th:text="${r'$'}{#dates.format(viewObject.${field.columnName!}, 'yyyy-MM-dd')}"
                 class="form-control-static div-underline"></div>
          <#else >
            <div id="${field.columnName!}" name="${field.columnName!}" th:text="*{${field.columnName!}}"
                 class="form-control-static div-underline"></div>
          </#if>
      </div>

          <#if field_index %2!=0 || !field_has_next >
            </div>
          </#if>
</#list>
    <div class="row form-group">
      <label class="col-sm-2 control-label">有效标志：</label>
      <div class="col-sm-4">
        <div id="isValid" name="isValid" th:text="*{isValid}"
             class="form-control-static div-underline"></div>
      </div>
      <label class="col-sm-2 control-label">创建人：</label>
      <div class="col-sm-4">
        <div id="createdBy" name="createdBy" th:text="*{createdBy}"
             class="form-control-static div-underline"></div>
      </div>
    </div>
    <div class="row form-group">
      <label class="col-sm-2 control-label">创建时间：</label>
      <div class="col-sm-4">
        <div id="createdTime" name="createdTime"
             th:text="${r'${#dates.format(viewObject.createdTime, "yyyy-MM-dd")}'}"
             class="form-control-static div-underline"></div>
      </div>
      <label class="col-sm-2 control-label">更新人：</label>
      <div class="col-sm-4">
        <div id="updatedBy" name="updatedBy" th:text="*{updatedBy}"
             class="form-control-static div-underline"></div>
      </div>
    </div>
    <div class="row form-group">
      <label class="col-sm-2 control-label">更新时间：</label>
      <div class="col-sm-4">

      </div>
    </div>
  </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
  var prefix = ctx + "${tableName}";
  $("#form-${tableName}-edit").validate({
    onkeyup: false,
    rules: {
      isValid: {maxlength: 1},
      createdBy: {maxlength: 32},
      createdTime: {date: true},
      updatedBy: {maxlength: 32},
      updatedTime: {date: true},
    },
    focusCleanup: true
  });

  function submitHandler() {
    if ($.validate.form()) {
      $.operate.save(prefix + "/edit", $('#form-${tableName}-edit').serialize());
    }
  }

  <#list  columns as field>
  <#if field.javaType=="Date">
  $("input[name='${field.columnName}']").datetimepicker({
    format: "yyyy-mm-dd",
    minView: "month",
    autoclose: true
  });
  </#if>
  </#list>
</script>
</body>
</html>